package edu.java.homework.hw08.ipj10.exer02done;

public class Food {

    // --- Instance Variables --------------------------------------------------
    private String taste = null;
    private int calories = 0;
    private String type = null;

    // --- Constructors --------------------------------------------------------

    public Food() {

	System.out.println(getClass().getName());
    }

    public Food(String taste) {
	this.taste = taste;
    }

    public Food(String taste, int calories) {
	this(taste);
	this.calories = calories;

    }

    public Food(String taste, int calories, String type) {
	this(taste, calories);
	this.type = type;
    }

    // --- Methods -------------------------------------------------------------

    @Override
    public String toString() {
	return (getTaste() + ", " + getCalories() + ", " + getType());
    }

    // --- Getters and Setters -------------------------------------------------

    public String getTaste() {
	return taste;
    }

    public int getCalories() {
	return calories;
    }

    public String getType() {
	return type;
    }

    public void setTaste(String taste) {
	if (taste == null) {
	    throw new IllegalArgumentException("Null-pointer string");
	}
	this.taste = taste;
    }

    public void setCalories(int calories) {
	if (calories < 0) {
	    throw new IllegalArgumentException("Calories can;t be negative");
	}
	this.calories = calories;
    }

    public void setType(String type) {
	if (taste == null) {
	    throw new IllegalArgumentException("Null-pointer string");
	}
	this.type = type;
    }

}
